package com.echovin.esb.gateway.service;

import com.echovin.esb.gateway.model.GatewayIPLimitApi;

import java.util.List;

public interface GatewayIPLimitService {

    /**
     * 分页查询
     *
     * @param pageParams
     * @return
     */
//    IPage<GatewayIpLimit> findListPage(PageParams pageParams);

    /**
     * 查询白名单
     *
     * @return
     */
    List<GatewayIPLimitApi> findBlackList();

    /**
     * 查询黑名单
     *
     * @return
     */
    List<GatewayIPLimitApi> findWhiteList();

    /**
     * 查询策略已绑定API列表
     *
     * @return
     */
    List<GatewayIPLimitApi> findIpLimitApiList(Integer policyId);

    int delete(GatewayIPLimitApi record);
    int update(GatewayIPLimitApi record);

    /**
     * 获取IP限制策略
     *
     * @param policyId
     * @return
     */
    GatewayIPLimitApi getIpLimitPolicy(short policyId);

    /**
     * 添加IP限制策略
     *
     * @param policy
     * @return
     */
    GatewayIPLimitApi addIpLimitPolicy(GatewayIPLimitApi policy);

    /**
     * 更新IP限制策略
     *
     * @param policy
     */
    GatewayIPLimitApi updateIpLimitPolicy(GatewayIPLimitApi policy);

    /**
     * 删除IP限制策略
     *
     * @param policyId
     */
    void removeIpLimitPolicy(short policyId);

    /**
     * 绑定API, 一个API只能绑定一个策略
     *
     * @param policyId
     * @param apis
     */
    void addIpLimitApis(short policyId, String... apis);

    /**
     * 清空绑定的API
     *
     * @param policyId
     */
    void clearIpLimitApisByPolicyId(short policyId);

    /**
     * API解除所有策略
     *
     * @param apiId
     */
    void clearIpLimitApisByApiId(short apiId);

}
